<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<link href="css/index/bootstrap/3.3.6/bootstrap.min.css"
	rel="stylesheet" />
<script src="js/index/jquery/2.0.0/jquery.min.js"></script>
<script src="js/index/bootstrap/3.3.6/bootstrap.min.js"></script>
<script src="js/jquery-3.2.1.js"></script>
<script type="text/javascript"
	src="js/index/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/index/pcasunzip1.js"
	charset="gb2312"></script>
<script type="text/javascript">
        $(function(){
        	//为还车城市添加点击事件
            $("#city").change(function(){
                var cname = $(this).val();
                //alert(cname);
              
                    	 $.getJSON("indexTest", {
                             name:cname
                         }, function(e3) {
                            
                             $(".list_door").children().remove();
                             if(e3.length==0){
                                 alert("该地区暂无门店！请重新选择");
                                 $("#city").focus();
                                 $(".list_door").append( "<option>"+"暂无门店！"+"</option>" );
                             }else{
                            	 for(var i=0;i<e3.length;i++){
                                     // alert(e3[i].sname);
                                      $(".list_door").append( "<option value='"+e3[i].id+"'>"+e3[i].sname+"</option>" );
                                      $(".list_door").append(e3[i].sname);
                              }
                             }
                            
                         })
                
            })
            
            //为选取车城市添加点击事件
             $("#selCity").change(function(){
                var xcname = $(this).val();
              
                         $.getJSON("rentcarajax", {
                             rname:xcname
                         }, function(e2) {
                            // alert(JSON.stringify(e2)); 
                            
                             $("#list_door").children().remove();
                             if(e2.length==0){
                                 alert("该地区暂无门店！请重新选择");
                                 $("#selCity").focus();
                                 $("#list_door").append( "<option>"+"暂无门店！"+"</option>" );
                             }else{
                                 for(var i=0;i<e2.length;i++){
                                     // alert(e2[i].sname);
                                      $("#list_door").append( "<option value='"+e2[i].id+"'>"+e2[i].sname+"</option>" );
                                      $("#list_door").append(e2[i].sname);
                              }
                             }
                            
                             //$("#list_door").text(e3.)
                         })
            })
            
        })
        
           
            function form_smt(){
                var a = $("#province").val();
                var  b = $("#city").val();
                var c = $("#area").val();
                var time = $("#timePicker").val();
                var times = $(".time-picker").val();
                var date = $("#d11").val();
                var dates = $("#d12").val();
                var a1 = $("#selProvance").val();
                var b1 = $("#selCity").val();
                var c1 = $("#selArea").val();
                var starttime = new Date(date.replace("-", "/").replace("-", "/"));  
                var endtime =  new Date(dates.replace("-", "/").replace("-", "/")); 
                if(a==""||a==null||a1==00000){
                	alert("请选择省份");
                	return;
                }else if(b!=b1){
                	alert("很抱歉，目前仅支持同城租还车")
                	return;
                }else if(endtime<starttime){
                	alert("还车日期不能早于租车日期");
                	return;
                }
              else if(date==""||date==null||dates==""||dates==null){
                	alert("请选择日期");
                	return;     
                }
                else{
                	//验证完成，将数据提交到servlet页面
                	$("form").submit();
                }
                
            }
        /**$().ready(function(e) {
            $("#timePicker").hunterTimePicker();
            $(".time-picker").hunterTimePicker();
        });**/
        </script>
<body>
	<div class="header_all">
		<div class="main">
			<div class="box_content">
				<div class="get_car left">
					<form action="/fuhe/fastorder" method="post">
						<span>取车</span>
						<div class="down_province ">
							<select id="selProvance" name="s_province"></select>  
						</div>
						<div class="down_city">
							<select id="selCity" name="s_city"></select>  
						</div>
						<div class="down_area" style="display:none">
							<select id="selArea" name="s_county"></select>
						</div>
						<script class="resources library" src="js/index/area.js"
							type="text/javascript"></script>
						<script type="text/javascript">_init_area();</script>
						<div class="down_store">
							<select id="list_door" name="get_door">
								<option selected="selected">请选择门店！</option>
							</select>
						</div>
						<input type="text" name="time" id="d11" class="down_date"
							onclick="WdatePicker({minDate:'%y-%M-%d 00:00:00'})" placeholder="选择日期">
				</div>

				<div class="reback_car left">
					<span>还车</span></br> <select name="user.province" id="province"></select>
					<select name="user.city" id="city" onchange=" getStore()"></select>
					<select name="user.area" id="area" style="display:none"></select><br>

					<script language="javascript" defer>
                            new PCAS("user.province", "user.city", "user.area", "null", "null", "null");
                        </script>

					<div class="down_store">
						<select class="list_door" name="reback_door">
							<option selected="selected">请选择门店！</option>
						</select>
					</div>
					<input type="text" name="time1" id="d12" class="down_date"
						onclick="WdatePicker({minDate:'%y-%M-%d 00:00:00'})" placeholder="选择日期">
				</div>
				<buttun class="btn btn-info clear" id="search_submit"
					onclick="form_smt()">快速订车</buttun>
				</form>
			</div>

		</div>
	</div>
</body>

</html>